<template>
    <el-dialog
      :visible.sync="state.visible"
      :fullscreen="fullscreen"
      :custom-class="!fullscreen ? 'custom-height': 'custom-fullscreen'"
      :close-on-click-modal="false"
      :show-close="false"
      @closed="close"
    >
        <el-row slot="title" type="flex">
            <el-col :span="20">{{ title }}</el-col>
            <el-col :span="4" style="text-align: right">
                <svg-icon
                  :icon-class="!fullscreen ? 'fullscreen': 'exit-fullscreen'"
                  style="cursor: pointer; margin-right: 10px"
                  @click="() => {fullscreen = !fullscreen}"
                />
                <i class="el-icon-close" style="cursor: pointer" @click="close" />
            </el-col>
        </el-row>
        <el-form ref="dataForm" :model="form" label-position="right" label-width="100px">
  <el-row :gutter="18">
      <el-col :span="24">
        <el-form-item
          label="零件图号"
        >
          <el-input
            placeholder="请输入零件图号"
            v-model="form.partDrawingNumber"
          />
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item
          label="任务名称"
        >
          <el-input
            placeholder="请输入任务名称"
            v-model="form.taskName"
          />
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item
          label="任务数量"
        >
        <el-input-number
          v-model="form.quantity"
          controls-position="right"
          placeholder="请输入任务数量"
        />
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item
          label="毛坯"
        >
          <el-input
            placeholder="请输入毛坯"
            v-model="form.blank"
          />
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item
          label="计划编号"
        >
          <el-input
            placeholder="请输入计划编号"
            v-model="form.planNum"
          />
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item
          label="开始时间"
        >
          <el-date-picker
            v-model="form.startTime"
            type="datetime"
          />
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item
          label="结束时间"
        >
          <el-date-picker
            v-model="form.endTime"
            type="datetime"
          />
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item
          label="图纸"
        >
          <upload
            v-if="state.visible"
            :prefix="filePrefix"
            :action="fileAction"
            :file-list="fileWrapper.picNumList"
            :rel-obj-type="relObjType"
            rel-obj-field="picNum"
            :limit-count="9"
            :is-image="true"
            list-type="picture-card"
            v-model="form.picNum"
          ></upload>
        </el-form-item>
      </el-col>
  </el-row>
</el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="close">
                取消
            </el-button>
            <el-button type="primary" :loading="state.confirmSubmit" :disabled="state.confirmSubmit" @click="onSubmit">
                确定
            </el-button>
        </div>
    </el-dialog>
</template>

<script>
import form from '@/components/diboot/mixins/form'
import Upload from '@/components/diboot/components/upload/Upload'
export default {
  name: 'ProductTaskForm',
  components: {
    Upload
  },
  mixins: [form],
  data() {
    return {
      baseApi: '/productTask',
      filePrefix: '/api',
      fileAction: '/uploadFile/upload/dto',
      relObjType: 'ProductTask',
      fileWrapper: {
        picNumList: [],
      },
      isUpload: true
    }
  },
  methods: {
async enhance(values) {
 this.__setFileUuidList__(values) 
},
async afterOpen(id) {
 if (id) {
        // 回显图纸
        this.echoImgFile(id, 'picNum')
      } 
},
  }
}
</script>
<style lang="scss" scoped>
</style>
